{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "02959eb9",
   "metadata": {},
   "source": [
    "# 导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "2eda67b4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>12669</td>\n",
       "      <td>9656</td>\n",
       "      <td>7561</td>\n",
       "      <td>214</td>\n",
       "      <td>2674</td>\n",
       "      <td>1338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>7057</td>\n",
       "      <td>9810</td>\n",
       "      <td>9568</td>\n",
       "      <td>1762</td>\n",
       "      <td>3293</td>\n",
       "      <td>1776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>6353</td>\n",
       "      <td>8808</td>\n",
       "      <td>7684</td>\n",
       "      <td>2405</td>\n",
       "      <td>3516</td>\n",
       "      <td>7844</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>13265</td>\n",
       "      <td>1196</td>\n",
       "      <td>4221</td>\n",
       "      <td>6404</td>\n",
       "      <td>507</td>\n",
       "      <td>1788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>22615</td>\n",
       "      <td>5410</td>\n",
       "      <td>7198</td>\n",
       "      <td>3915</td>\n",
       "      <td>1777</td>\n",
       "      <td>5185</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Channel  Region  Fresh  Milk  Grocery  Frozen  Detergents_Paper  Delicassen\n",
       "0        2       3  12669  9656     7561     214              2674        1338\n",
       "1        2       3   7057  9810     9568    1762              3293        1776\n",
       "2        2       3   6353  8808     7684    2405              3516        7844\n",
       "3        1       3  13265  1196     4221    6404               507        1788\n",
       "4        2       3  22615  5410     7198    3915              1777        5185"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "sales_data = pd.read_csv('Wholesale customers data.csv')\n",
    "sales_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b0422a60",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 440 entries, 0 to 439\n",
      "Data columns (total 8 columns):\n",
      " #   Column            Non-Null Count  Dtype\n",
      "---  ------            --------------  -----\n",
      " 0   Channel           440 non-null    int64\n",
      " 1   Region            440 non-null    int64\n",
      " 2   Fresh             440 non-null    int64\n",
      " 3   Milk              440 non-null    int64\n",
      " 4   Grocery           440 non-null    int64\n",
      " 5   Frozen            440 non-null    int64\n",
      " 6   Detergents_Paper  440 non-null    int64\n",
      " 7   Delicassen        440 non-null    int64\n",
      "dtypes: int64(8)\n",
      "memory usage: 27.6 KB\n"
     ]
    }
   ],
   "source": [
    "# 数据查看\n",
    "sales_data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c8b87784",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.322727</td>\n",
       "      <td>2.543182</td>\n",
       "      <td>12000.297727</td>\n",
       "      <td>5796.265909</td>\n",
       "      <td>7951.277273</td>\n",
       "      <td>3071.931818</td>\n",
       "      <td>2881.493182</td>\n",
       "      <td>1524.870455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.468052</td>\n",
       "      <td>0.774272</td>\n",
       "      <td>12647.328865</td>\n",
       "      <td>7380.377175</td>\n",
       "      <td>9503.162829</td>\n",
       "      <td>4854.673333</td>\n",
       "      <td>4767.854448</td>\n",
       "      <td>2820.105937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>55.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3127.750000</td>\n",
       "      <td>1533.000000</td>\n",
       "      <td>2153.000000</td>\n",
       "      <td>742.250000</td>\n",
       "      <td>256.750000</td>\n",
       "      <td>408.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>8504.000000</td>\n",
       "      <td>3627.000000</td>\n",
       "      <td>4755.500000</td>\n",
       "      <td>1526.000000</td>\n",
       "      <td>816.500000</td>\n",
       "      <td>965.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>16933.750000</td>\n",
       "      <td>7190.250000</td>\n",
       "      <td>10655.750000</td>\n",
       "      <td>3554.250000</td>\n",
       "      <td>3922.000000</td>\n",
       "      <td>1820.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>112151.000000</td>\n",
       "      <td>73498.000000</td>\n",
       "      <td>92780.000000</td>\n",
       "      <td>60869.000000</td>\n",
       "      <td>40827.000000</td>\n",
       "      <td>47943.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          Channel      Region          Fresh          Milk       Grocery        Frozen  Detergents_Paper    Delicassen\n",
       "count  440.000000  440.000000     440.000000    440.000000    440.000000    440.000000        440.000000    440.000000\n",
       "mean     1.322727    2.543182   12000.297727   5796.265909   7951.277273   3071.931818       2881.493182   1524.870455\n",
       "std      0.468052    0.774272   12647.328865   7380.377175   9503.162829   4854.673333       4767.854448   2820.105937\n",
       "min      1.000000    1.000000       3.000000     55.000000      3.000000     25.000000          3.000000      3.000000\n",
       "25%      1.000000    2.000000    3127.750000   1533.000000   2153.000000    742.250000        256.750000    408.250000\n",
       "50%      1.000000    3.000000    8504.000000   3627.000000   4755.500000   1526.000000        816.500000    965.500000\n",
       "75%      2.000000    3.000000   16933.750000   7190.250000  10655.750000   3554.250000       3922.000000   1820.250000\n",
       "max      2.000000    3.000000  112151.000000  73498.000000  92780.000000  60869.000000      40827.000000  47943.000000"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 各数据列统计\n",
    "sales_data.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b45c3e36",
   "metadata": {},
   "source": [
    "# 数据预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "cff618aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.70833271, 0.53987376, 0.42274083, 0.01196489, 0.14950522,\n",
       "        0.07480852],\n",
       "       [0.44219826, 0.61470384, 0.59953989, 0.11040858, 0.20634248,\n",
       "        0.11128583],\n",
       "       [0.39655169, 0.5497918 , 0.47963217, 0.15011913, 0.2194673 ,\n",
       "        0.48961931],\n",
       "       ...,\n",
       "       [0.36446153, 0.38846468, 0.7585445 , 0.01096068, 0.37223685,\n",
       "        0.04682745],\n",
       "       [0.93773743, 0.1805304 , 0.20340427, 0.09459392, 0.01531   ,\n",
       "        0.19365326],\n",
       "       [0.67229603, 0.40960124, 0.60547651, 0.01567967, 0.11506466,\n",
       "        0.01254374]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.preprocessing import Normalizer\n",
    "\n",
    "train_data = sales_data.iloc[:, 2:]\n",
    "train_data_ = Normalizer().fit(train_data).transform(train_data)\n",
    "train_data_"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b100caab",
   "metadata": {},
   "source": [
    "# 适用轮廓系数找到最优K"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "5792376c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.lines.Line2D at 0x1da5c494a90>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsh0lEQVR4nO3deXxU9fX/8dfJRiCENQmyhx1ZBcJOFfyqxVZBBAsuCC5lV2u1ftW2tsVvbW2/P21VQBFFiwuboOBarVAlrAmbbGFfwmLCkrCEEEjO748Z+KYYyJDM5M7cOc/HgweZO597530dOXNz7p3PFVXFGGOMe0U4HcAYY0xgWaE3xhiXs0JvjDEuZ4XeGGNczgq9Mca4XJTTAS6WkJCgycnJTscwxpiQkp6eflhVE0t6LugKfXJyMmlpaWVa90DOaQDq1ajsz0jGGBP0RGTPpZ4LukJfHo/OWgvArNE9nQ1ijDFBxFWF/qHrWzgdwRhjgo6rCn2fFglORzDGmKDjqqtu9h7JY++RPKdjGGNMUHHVEf2v5q4DrEdvjDHF+XRELyL9RSRDRLaLyJMlPD9SRLJFZK33z4PFnhshItu8f0b4M/zFHr2xJY/e2DKQL2GMMSGn1CN6EYkEJgE3ApnAKhFZoKqbLho6S1UnXLRuLeB3QAqgQLp33WN+SX+RHk1rB2KzxhgT0nw5ou8GbFfVnapa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aLyLWBfLGQLPTevukHwLuqOq+EIfuB4p/mDbzLgk5p+6Kqx8+3EVT1UyBaRBIqOOYVUdUcYBHQ/6KnLrwvIhIFVAeOVGi4K3SpfVHVI6p6xvtwGtClgqP5ojcwQER2AzOB60XknYvGhMp7Uuq+hMh7AoCq7vf+nQXMB7pdNMSvNSzkCr23f/gGsFlVX7jEsAXAvd4z1z2AXFU9WGEhfeTLvojIVed7piLSDc97FnT/EEUkUURqeH+uDNwIbLlo2AJghPfnIcDXGoTf2PNlXy7qlw7Ac34lqKjqU6raQFWTgWF4/nvfc9GwkHhPfNmXUHhPAEQkznvxBSISB9wEbLhomF9rWCheddMbGA585+2hAjwNNAJQ1VeBT4GfANuBPOC+io/pE1/2ZQgwVkTOAaeBYcH4DxGoC7wtIpF4Poxmq+rHIjIRSFPVBXg+1GaIyHbgKJ5/sMHIl315WEQG4Lly6igw0rG0VyhE35MSheh7UgeY7z1+iwLeU9XPRWQMBKaG2RQIxhjjciHXujHGGHNlrNAbY4zLWaE3xhiXs0JvjDEuZ4XeGGNczgq9Mca4nBV6Y4xxuf8PC6311OTVuzwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "from sklearn.metrics import silhouette_score # 轮廓系数\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "score = []\n",
    "model = []\n",
    "\n",
    "#将K值从2到6\n",
    "for i in range(2,6):\n",
    "    kmeans_ = KMeans(n_clusters=i)\n",
    "    cluster = kmeans_.fit(train_data_)\n",
    "    score.append(silhouette_score(train_data_, cluster.labels_))\n",
    "    model.append(kmeans_)\n",
    "    \n",
    "plt.plot(range(2, 6), score)\n",
    "plt.axvline(pd.DataFrame(score).idxmax()[0]+2, ls=':')# 最高点设置虚线\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "291ef025",
   "metadata": {},
   "source": [
    "# 建模及可视化分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "977ee843",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.869573</td>\n",
       "      <td>0.174954</td>\n",
       "      <td>0.226061</td>\n",
       "      <td>0.224904</td>\n",
       "      <td>0.050075</td>\n",
       "      <td>0.074002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.264083</td>\n",
       "      <td>0.479221</td>\n",
       "      <td>0.661907</td>\n",
       "      <td>0.134295</td>\n",
       "      <td>0.251450</td>\n",
       "      <td>0.105409</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Fresh      Milk   Grocery    Frozen  Detergents_Paper  Delicassen\n",
       "0  0.869573  0.174954  0.226061  0.224904          0.050075    0.074002\n",
       "1  0.264083  0.479221  0.661907  0.134295          0.251450    0.105409"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kmeans_ = model[0]\n",
    "center = pd.DataFrame(kmeans_.cluster_centers_, columns=['Fresh', 'Milk', 'Grocery', 'Frozen', 'Detergents_Paper', 'Delicassen'])\n",
    "center"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "efba6327",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1da600a6e80>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAWlUlEQVR4nO3deZgU1b3G8W/1AgMIzSKLAlIaY0RRRBZ3MYkbjmg0Imi8MbhdTa5BEhLLXL0plYutEWPidQ1RY9wFImqhJq64AhLAEGRRaVkUAYGCYZi1+/5RDQKyzNLdv1Pdv8/z9OMM0H3eceadU9VVdcrKZDIopcwTkQ6glNo5LadShtJyKmUoLadShtJyKmUoLadShtJyKmUoLadShtJyKmUoLadShopJB1CquWbNmtUlFotNAPpg7oSTBubV1dVd1r9//1UNeYKWU4VeLBab0K1bt96dO3deF4lEjDxZPJ1OW6tXrz5k5cqVE4CzGvIcU3/LKNUYfTp37rzB1GICRCKRTOfOnX2C2b1hz8ljHqUKJWJyMbfIZmxw57ScShlK9zlV0bEdr38uXy+VLJ/VkH83ceLEdmPGjNkvnU5z0UUXrRk3btzK5oyrM6dSOVBXV8fo0aP3mzp16qJFixb9e9KkSR1nzZpV1pzX1HIqlQNvvPFGm169elUfcsghNWVlZZlzzz137cSJE9s35zW1nErlwLJly1p07969ZsvnPXr0qFmxYkWL5rymllMpQ2k5lcqBnj17bjdTLl++fLuZtCm0nErlwODBgzelUqmyBQsWtKiqqrImT57c8Yc//OH65rymHkpRRaehhz5yKR6PM378+KWnn376QfX19Vx44YVrBgwYUNWc19RyKpUjw4cP94cPH+7n6vV0s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69kVKVQTaTlzzU0cAFxGMJt2E05TKEsI1mx6sNROTs8nLWe+uIkYcCpwFjAU2Fc2UM4tJJglpwDv6yyZe1rOQnATFsH5u1uK2k82UJOkgfcJyjillK6rlKLllBAckjkVOAoYBPQBoqKZvikNfEhwdcg7wGu6yVpYWk4TuInWBBeAbylrf2A/CneLxiqC1SHmEtyx7QNglh76kKXlNFWwz9oDsHd49ALaA22A1tv8t8UOr1ADVACbtnn4wGcEt8dbss1jpe4zmkfLWSyCMrcmOIyzCdfXWyKGnJZTKUPp9ZxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGUrLqZShtJxKGer/AXteaH5NkxKFAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "km_labels = pd.Series(kmeans_.labels_)\n",
    "sizes = km_labels.value_counts(1).values\n",
    "labels = km_labels.value_counts(1).index\n",
    "plt.pie(sizes, autopct='%.f%%')\n",
    "plt.legend(labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "b09401b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([0, 1]), [Text(0, 0, '0'), Text(1, 0, '1')])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAbvklEQVR4nO3de1RVdf7/8ecb1DBtWF5oKjGx+ZqGXI6IaD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n6LFjx2jVqhUTJkxg+vTpANxyyy0UFBSQkJCAc46IiAgyMzOJi4sjNDSU+Ph4UlNT+eMf/1jtuKquvPJK3n//faKjo+natSsJCQmEh4fTpk0bli9fzl133cWhQ4c4fvw4f/rTn2oN9EsvvZSHH34Yn8/H/fffzyeffMIHH3xASEgIvXv35rLLLvtFfw7z5s2jf//+RERE0L9//1P+Z3HuueeSlJTE4cOHefbZZwkLC6vxz0a8za9+6GY2EvgfyubHX3DOPWRmaUC2c26Flf3O9zgwAigFHnLOLavtmOqH3vS1xH7oxcXFtG/fngMHDpCUlMTatWs566yzgl1WjVJTUxk1ahRXXXVVQI6nfuhNX2390P2aQ3fOrQRWVlk3u9JrB0wv/0+k2Ro1ahTfffcdP/30E3/5y1+adJiLVKVH/0UqqfqBakP54osvmDBhwinrTjvtND777LNfdJzFixcHsCpp7hToIkEQGxv7sztZRH4t9XIREfEIBbqIiEco0EVEPEJz6OK3x68dFdDj3ZPxVp1jQkNDiY2NrbgPfeLEidx9992EhNR8LVJQUMCoUaPYunUr2dnZvPTSSzz11FOBLF2kSVKgS5N2sn0uwP79+7n++us5fPhwnS10T0pMTCQxsdpbdkU8R1Mu0mz42z63sjVr1jBqVNlvFsXFxdx4443ExsYSFxfHa6+9BsAdd9xBYmIivXv3Zs6cORX7zpw5k+joaOLi4rj33nuBssfsY2JiiI+P5+KLLwZqb1U7aNAgrrrqKnr16sX48ePx50E+kfrSFbo0K/60z63arOqkefPmER4ezhdflD25ePDgQQAeeughOnbsSGlpKUOGDGHLli106dKFN954gx07dmBmfPfddwCkpaXx7rvv0qVLl4p1zz//fI2taj///HNyc3M555xzSE5OZu3atfz+979v2D8kabF0hS7N1qpVq3jppZfw+Xz079+fAwcOkJeXV+P4rKwspkyZUrHcoUMHAF599VUSEhLo06cPubm5bNu2jfDwcMLCwrj55pt5/fXXOf3004GyBl6pqak899xzlJaW1llHUlISkZGRhISE4PP5amyvKxIIukKXZsWf9rm/JDS//PJLFixYwIYNG+jQoQOp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BXKiIitaoz0M0sFEgHLgOigXFmFl1l2M3AQefcfwFPAo8EulAREamdP1foSUC+c26Pc+4nYBkwusqY0cCS8tfLgSFmZoErU0RE6mLOudoHmF0FjHDO3VK+PAHo75ybWmnM1vIxheXLu8vHfFPlWLcBt5Uv9gR2BupEhM7AN3WOEml8+rsZWN2ccxHVbWjU5lzOuUXAosZ8z5bCzLKdc4nBrkOkKv3dbDz+TLnsA7pWWo4sX1ftGDNrBYQDBwJRoIiI+MefQN8A9DCz7mbWBrgOWFFlzApgUvnrq4DVrq65HBERCag6p1ycc8fNbCrwLhAKvOCcyzWzNCDbObcCeB74XzPLB76lLPSlcWkqS5oq/d1sJHV+KCoiIs2DnhQVEfEIBbqIiEco0Ju5utoyiASLmb1gZvvLn1ORRqBAb8b8bMsgEiyLgRHBLqIlUaA3b/60ZRAJCufcR5Td9SaNRIHevHUB9lZaLixfJyItkAJdRMQjFOjNmz9tGUSkhVCgN2/+tGUQkRZCgd6MOeeOAyfbMmwHXnXO5Qa3KpEyZrYUWAf0NLNCM7s52DV5nR79FxHxCF2hi4h4hAJdRMQjFOgiIh6hQBcR8QgFuoiIRyjQRUQ8QoEuIuIR/w+Lplurp+xJaQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "center.plot(kind='bar')\n",
    "plt.xticks(rotation=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07a8470e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
